import 'package:flutter/material.dart';
import 'package:flutter_stort/page/web_details_page.dart';
import 'package:flutter_stort/utils/jump_util.dart';

///关于我们
class AboutPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "关于我们",
          style: TextStyle(
            fontSize: 20,
          ),
        ),
      ),
      body: ListView(
        children: [
          Container(
            height: 130,
            width: 100,
            alignment: Alignment.center,
            child: Image.asset(
              "images/ic_empty.png",
              width: 90,
              height: 90,
            ),
          ),
          _itemView(
            title: "用户协议",
            onClick: () => JumpPageUtils.startNextWidget(
              context,
              WebDetailsPage(
                title: "用户协议",
                url: "https://www.baidu.com",
              ),
            ),
          ),
          _itemView(
            title: "隐私协议",
            onClick: () => JumpPageUtils.startNextWidget(
              context,
              WebDetailsPage(
                title: "隐私协议",
                url: "https://www.baidu.com",
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class _itemView extends StatelessWidget {
  String title;
  GestureTapCallback onClick;

  _itemView({this.title, this.onClick});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onClick,
      child: Container(
        padding: EdgeInsets.all(10),
        height: 50,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Expanded(
              child: Text(
                title,
                style: TextStyle(
                  color: Colors.black,
                  fontSize: 18,
                ),
              ),
            ),
            Icon(
              Icons.navigate_next,
              color: Colors.grey,
              size: 24,
            ),
          ],
        ),
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border(
            bottom: BorderSide(
              color: Colors.grey,
              width: 0.5,
              style: BorderStyle.solid,
            ),
          ),
        ),
      ),
    );
  }
}
